package com.example.dnfgamercommunitybackend.controller;

import com.example.dnfgamercommunitybackend.entity.ReplyComment;
import com.example.dnfgamercommunitybackend.service.ReplyCommentService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@RestController
public class ReplyCommentController {
    @Resource
    private ReplyCommentService replyCommentService;
    @PreAuthorize("hasAuthority('user:comment_reply_comment')")
    @PostMapping("/comment/replyComment")
    public String addReplyComment(@RequestBody ReplyComment replyComment, HttpServletRequest request){
        return replyCommentService.addReplyComment(replyComment,request.getHeader("Authorization"));
    }

    @PreAuthorize("hasAuthority('user:comment_delete_reply_comment')")
    @GetMapping("/comment/deleteReplyComment")
    public String deleteReplyComment(@RequestParam int replyCommentId){
        return replyCommentService.deleteReplyComment(replyCommentId);
    }

}
